import { request } from "@utils/http/index"


import type {
    getHosListSearchParamsType,    //获取分页列表请求的参数中的params的类型
    getHosListReqReturnType,       //获取分页列表请求返回值的完整类型
    getProvinceListReqReturn,      //三级列表返回值的类型
    getHospitalListIdReqReturn,    //id获取医院详情请求返回值类型
    getHosDepartmentReturnType,    //请求科室列表中返回值的类型
    getHosScheduleRuleParamsType,  //请求排班规则参数的类型
    getHosScheduleRuleReturnType,  //排班规则请求返回值的类型
    getHosScheduleMessageParamsType,   //排班规则详细信息参数类型
    getHosScheduleMessageReturnType,  //排班规则详细信息返回值的类型
} from "./model/hospitalListType"


//1.医院列表中 , 获取分页列表请求
export const getHospitalListRequest = (page:number , limit:number , searchParams:getHosListSearchParamsType) => {
    return request.get<any , getHosListReqReturnType>(`/admin/hosp/hospital/${page}/${limit}` , {
        params: searchParams
    })
}

//2.医院列表中 , 获取省的请求
export const getProvinceListRequest = () => {
    return request.get<any , getProvinceListReqReturn>("/admin/cmn/dict/findByDictCode/province")
}

//3.医院列表中 , 获取市或区的请求
export const getCityOrBlockRequest = (id:string) => {
    return request.get<any , getProvinceListReqReturn>(`/admin/cmn/dict/findByParentId/${id}`)
}

//4.医院详情中 根据id获取医院列表请求
export const getHospitalListIdRequest = (id:string) => {
    return request.get<any , getHospitalListIdReqReturn>(`/admin/hosp/hospital/show/${id}`)
}

//5.医院列表中 切换状态的请求
export const checkedStatusRequest = (id:string , status: 0 | 1) => {
    return request.get<any , null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}

//6.请求科室列表
export const getHospitalDepartmentRequest = (hoscode: string) => {
    return request.get<any , getHosDepartmentReturnType>(`/admin/hosp/department/${hoscode}`)
}

//7.请求排班规则
export const getHosScheduleRuleRequest = ({page , limit , hoscode , depcode}:getHosScheduleRuleParamsType) => {
    return request.get<any , getHosScheduleRuleReturnType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}

//8.请求排班规则详细信息
export const getHosScheduleMessageRequest = ({hoscode , depcode , workDate}:getHosScheduleMessageParamsType) => {
    return request.get<any , getHosScheduleMessageReturnType>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}